package view;

import controller.ControllerGUINivelPrincipal;
import java.awt.BorderLayout;

public class GUISeleccionNivel extends javax.swing.JFrame {

    private ControllerGUINivelPrincipal ctrl;  
    private static GUISeleccionNivel instancia;
  
    /** Creates new form GUISeleccionNivel */
    public GUISeleccionNivel() {
        initComponents();
        PanelFondo2 F = new PanelFondo2();
        this.setResizable(false);
        this.add(F,BorderLayout.CENTER);
        this.pack();
    }

    
    public static GUISeleccionNivel getInstanciaGUINivel() {
        if (instancia == null){
            throw new NullPointerException();
        }
        return instancia; 
    }  

    public  static void crearInstanciaGUINivel(){
        if (instancia == null){
            instancia = new GUISeleccionNivel();
        }
    }




        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        label1 = new java.awt.Label();
        GrupodeBotones = new javax.swing.ButtonGroup();
        jLabelSeleccionarNivel = new javax.swing.JLabel();
        botonCancelar = new javax.swing.JButton();
        botonFacil = new javax.swing.JButton();
        botonMedio = new javax.swing.JButton();
        botonDificil = new javax.swing.JButton();

        label1.setText("label1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setBackground(new java.awt.Color(0, 153, 153));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jLabelSeleccionarNivel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabelSeleccionarNivel.setForeground(new java.awt.Color(153, 153, 255));
        jLabelSeleccionarNivel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelSeleccionarNivel.setText("Elegir Nivel");
        jLabelSeleccionarNivel.setToolTipText("");
        jLabelSeleccionarNivel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 255), 2));

        botonCancelar.setText("Cancelar");
        botonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCancelarActionPerformed(evt);
            }
        });

        botonFacil.setText("Facil");
        botonFacil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonFacilActionPerformed(evt);
            }
        });

        botonMedio.setText("Medio");
        botonMedio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonMedioActionPerformed(evt);
            }
        });

        botonDificil.setText("Dificil");
        botonDificil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonDificilActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(62, 62, 62)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(botonDificil)
                    .addComponent(botonMedio)
                    .addComponent(botonFacil)
                    .addComponent(botonCancelar)
                    .addComponent(jLabelSeleccionarNivel, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(63, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelSeleccionarNivel)
                .addGap(27, 27, 27)
                .addComponent(botonFacil)
                .addGap(18, 18, 18)
                .addComponent(botonMedio)
                .addGap(18, 18, 18)
                .addComponent(botonDificil)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                .addComponent(botonCancelar)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void botonCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelarActionPerformed
        this.dispose();
    }//GEN-LAST:event_botonCancelarActionPerformed

    private void botonFacilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonFacilActionPerformed
        ctrl = ControllerGUINivelPrincipal.getInstancia();
        ctrl.actionPerformed(evt);
        this.dispose();
       
    }//GEN-LAST:event_botonFacilActionPerformed

    private void botonMedioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonMedioActionPerformed
        ctrl = ControllerGUINivelPrincipal.getInstancia();
        ctrl.actionPerformed(evt);
        this.dispose();
    }//GEN-LAST:event_botonMedioActionPerformed

    private void botonDificilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonDificilActionPerformed
        ctrl = ControllerGUINivelPrincipal.getInstancia();
        ctrl.actionPerformed(evt);
        this.dispose();
    }//GEN-LAST:event_botonDificilActionPerformed

 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GUISeleccionNivel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GUISeleccionNivel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GUISeleccionNivel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GUISeleccionNivel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
         //       new GUISeleccionNivel().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup GrupodeBotones;
    private javax.swing.JButton botonCancelar;
    private javax.swing.JButton botonDificil;
    private javax.swing.JButton botonFacil;
    private javax.swing.JButton botonMedio;
    private javax.swing.JLabel jLabelSeleccionarNivel;
    private java.awt.Label label1;
    // End of variables declaration//GEN-END:variables

    
}
